<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
  <script>
    var message = "gloabal message"

    function foo() {
      var name = "foo"
      function bar() {
        console.log(name);
        function test() {
          console.log(message);
        }
        return test
      }
      return bar
    }

    var bar = foo()
    var test = bar()


    //题1
    var n = 100
    function f00() {
      var n = 200
    }
    f00()
    console.log(n);


    //题2
    var n = 100 
    function fn() {
      console.log(n);
      var n = 200
      console.log(n);
    }
    fn()

    //题3
    var n = 100
    function fn1() {
      console.log(n);
    }
    function fn2() {
      var n = 200
      console.log(n);
      fn1()
    }
    fn2()
    //题4
    var n = 100
    function fn3() {
      console.log(n);
      return
      var n = 200
    }
    fn3()
    //题5

  </script>
</body>
</html>